﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Text;

namespace Admx_Generator
{
    public class DropDownListPresentation : IPresentationElement
    {
        public DropDownListPresentation(string refId, string value)
        {
            this.RefId = refId;
            this.NoSort = false;
            this.DefaultItem = 0;
            this.Value = value;
        }

        private string RefId { get; set; }
        private bool NoSort { get; set; }
        private uint DefaultItem { get; set; }
        private string Value { get; set; }

        public void Save(XmlWriter xmlWriter)
        {
            // dropDownList
            xmlWriter.WriteStartElement("dropDownList");
            xmlWriter.WriteAttributeString("refId", this.RefId);
            xmlWriter.WriteAttributeString("noSort", this.NoSort.ToString().ToLower());
            xmlWriter.WriteAttributeString("defaultItem", this.DefaultItem.ToString());
            xmlWriter.WriteValue(this.Value);
            xmlWriter.WriteEndElement(); // dropDownList
        }
    }
}
